
<%@page import="model.Operateur"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html >

<head>
          <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
          <meta name="author" content="MWH Team 2" />

       <script type="text/javascript" src="fichier/jquery-1.10.2.js"></script>
      <%/* <script type="text/javascript" src="fichier/init.js"></script> */ %>
       <script type="text/javascript" src="fichier/calendrier.js"></script>
       <link rel="stylesheet" media="screen" type="text/css" title="Design" href="fichier/design.css" />    
          <link href="./fichier/bootstrap.min.css" rel="stylesheet">
          <link href="./fichier/Site.css" rel="stylesheet">
     
         <title>Gestion des Lignes</title>
        
</head>

<body>
<script language="JavaScript" type="text/javascript">

function getsupport ( )
{
  
  document.SupportForm.submit() ;
}

</script> 
    
</script> 

 <% 
       Operateur p = new Operateur();
       String  info="";
       String  info1="";
       String info2="";
       String Newligne=System.getProperty("line.separator");
  
       
       if (session.getAttribute("oppp")==null){%>
    	<SCRIPT LANGUAGE='JavaScript'>
        window.alert('Veuillez vous identifier');
        window.location.href='Connexion.jsp';
        </SCRIPT>
 <%    } else { 
     	p = (Operateur) session.getAttribute("oppp");
     	 if (p.getIsadmin().equals("false"))
     	 {
     		  %>
         		<SCRIPT LANGUAGE='JavaScript'>
                window.alert('Veuillez vous identifier comme Admin');
                window.location.href='Index.jsp';
                </SCRIPT><%   
     	 }
     	 else
     	 {
    	    
     		info = p.getNomoperateur(); 
     		info2="Administrateur";
     		info1="admin";
     	 }
 }
    %>
                 
                   

    
   <script language="JavaScript" type="text/javascript">

function getsupport ( )
{
  
  document.SupportForm.submit() ;
}

</script> 


    <div  style="padding-bottom:30px; margin-top:-10px; background-color: green; background-image: url('./fichier/occpp.png'); 
   
    -webkit-background-size: cover;
     -moz-background-size: cover;
     -o-background-size: cover;
      background-size: cover;
       

   "  >
 		<div> <label  style="margin-left:1150px; margin-top:30px; margin-right: 2px; color:#ffffff; font-family: Calibri, sans-serif; "><%=info %><br/><%=info2 %></label></div>

        <p   style="color:#ffffff; font-size:36px;  font-family: Coolvetica Rg;"  align="center">Cute Process UHT</p>
   </div>
<div class="row-offcanvas row-offcanvas-left">
<div id="sidebar" class="sidebar-offcanvas" style="margin-top:18px; ">
<form name="SupportForm" method="post" action="controle">
                         <input type="hidden" name="Adminpanel4" />
                <ul class="nav nav-pills nav-stacked">
                 
                    <li><a href="#">Acceuil</a></li>
                    <li class="active"><a href="Index.jsp">Saisie des Données</a></li>
                    <li class="active"><a href="Resultats.jsp">Resultats</a></li>
                    <li id="Adminpanel" ><a href="Ligne.jsp">Gestion des Lignes</a></li>
                    <li id="Adminpanel1"><a href="Categorie.jsp">Gestion des Categories</a></li>
                    <li id="Adminpanel2"><a href="Arret.jsp">Gestion des Arrêts</a></li>
                    <li id="Adminpanel3"><a href="Operateur.jsp">Gestion des Operateurs</a></li>
                    <li><a href="javascript:getsupport()">Deconnexion</a></li>
        
                     
                </ul>
</form>
        </div>
<button class="sidebar-trigger" data-toggle="offcanvas" style="margin-top:18px;"></button>
        <div id="main">

            

            <div class=" container-fluid body-content "  style="margin-top:10px; ">

    <h2 id="espaceF" class="button green center" align="center"  data-toggle="collapse" data-target="#Gestion1" >Operations sur les  Lignes</h2>
    <br><br>
    <div id="GestLigne">
    <div align="center" >
    	<input type="submit" name="AjouterLi" id="AjouterLi" value="Ajouter"/> 
    	<input type="submit" name="ModifierLi" id="ModifierLi" value="Modifier " />
    	<input type="submit" name="SupprimerLi" id="SupprimerLi" value="Supprimer"/>
    	<input type="submit" name="RechercherLi" id="RechercherLi" value="Rechercher"/>
    	<input type="hidden" name="RetournerLi" id="RetournerLi" value="Retourner"/>
    	<input type="submit" name="ViderM" id="ViderLi" value="Vider"/>
	</div>
 <div align="center">
 </br>
 <table  id="testTable1"  width="60%">
    	<tr>
         <td>ID Ligne</td>
         
         <td><input type="text" name="IdLigne" id="InputIdLi" /> </td>
         
         <td>Nom Ligne</td>
         
         <td><input type="text" name="NomLigne" id="InputNomLi" /> </td>       
              
        </tr>
 </table>

</div>
</div>

 <h2 align="center" class="button green center" data-toggle="collapse">List des Lignes</h2>
 <div>
  <br><br>
 
  
	<center id="Gestion1" class="collapse">
		
		<div id="affichage"  style="overflow:auto;">
        	<%@ include file="TableLi.jsp" %>
        </div> 
	</center>
		
   
	</div>



				  <script>
				  //Le script Ajaaaaaaaaaaaaaaaaaax
	       $(document).ready(function() {                        
	    	   var selectionCount = 1;

	            $('#AjouterLi').on("click", function () {


	                $.ajax({
	                    type: "GET",
	                    url: "controle?action=AjouterLi",
	                    data: {
	                    	IdLi: $("#InputIdLi").val(),
	                    	NomLi: $( "#InputNomLi" ).val(),	                    	
	                    	
	                    },
	                    success: function (result) {
	                        $("#affichage").html(result);
	                    }
	                });
	            });
	            
	            //Modifier
	            $('#ModifierLi').on("click", function () {


	                $.ajax({
	                    type: "GET",
	                    url: "controle?action=ModifierLi",
	                    data: {
	                    	IdLi: $("#InputIdLi").val(),
	                    	NomLi: $( "#InputNomLi" ).val(),

	                    },
	                    success: function (result) {
	                        $("#affichage").html(result);
	                    }
	                });
	            });
	            //Supprimer
	            $('#SupprimerLi').on("click", function () {


	                $.ajax({
	                    type: "GET",
	                    url: "controle?action=SupprimerLi",
	                    data: {
	                    	IdLi: $("#InputIdLi").val(),
	                     

	                    },
	                    success: function (result) {
	                        $("#affichage").html(result);
	                    }
	                });
	            });
	            //Recherche Par ID
	            $('#RechercherLi').on("click", function () {
	            	
	            	$("#RetournerLi").attr('type', 'submit');
	            	$("#RechercherLi").attr('type', 'hidden');

	                $.ajax({
	                    type: "GET",
	                    url: "controle?action=RechercherLi",
	                    data: {
	                    	IdLi: $("#InputIdLi").val(),
	                     

	                    },
	                 
	                    success: function (result) {
	                        $("#affichage").html(result);
	                    }
	                });
	            });
	            
	            //retourner Affichage
					$('#RetournerLi').on("click", function () {
						$("#RetournerLi").attr('type', 'hidden');
		            	$("#RechercherLi").attr('type', 'submit');
						        			
						                $.ajax({
						                    type: "GET",
						                    url: "controle?action=RetournerLi",
						                   
						                    success: function (result) {
						                        $("#affichage").html(result);
						                    }
						                });
						            });
	           
                   //Vider les Inputs
		            $('#ViderLi').on("click", function () {


		               $("#InputIdLi").val("");
                   	   $("#InputNomLi").val("");
                   	  
		            });
	            
	            //Affichage des valeurs dans les Inputs 
	            
	    
								            
	            $('#affichage').on("click", 'tbody tr', function () {
	                if ($(this).hasClass('selected')) {
	                
	                    selectionCount++;
	                    selectionCount = 1;
	                }

	                if (selectionCount == 1) {
	                	
	                	
	                    $(".selected").removeClass("selected");
	                    
	                    $(this).addClass("selected");
	                    
	                              
	                    var IdLi = $('.selected').find(".IdLi").text().trim();
	                    var NomLi = $('.selected').find(".NomLi").text().trim();
	                    
	               
	                    //changement du couleur
	                   $('#colonne tr').css('background','white');
	                   
                    	
                    	 $(this).css('background','#b6ea17');
                    	
                    	
                    	  $("#InputIdLi").val(IdLi);
                      	   $("#InputNomLi").val(NomLi);
                      	   
	                   
	                 }
	            });
													            var i=1;
															      $( "#GestLigne" ).hide();					
															     $( "#espaceF" ).click(function()  {					
															     	if(i % 2 == 0)
																{  $( "#GestLigne" ).hide( "slow");
																  i=i+1;
																}else
																{ $( "#GestLigne" ).show( "slow");
																  i=i+1;
																	}});
													            
																		     
				            });
				  
				  
				  
				        </script>


 

<script type="text/javascript" src="fichier/bootstrap.js"></script>
<script src="fichier/Site.js"></script>
</div>
</div>
</div>
</body>
</html>

